package edu.android;

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class NowActivity extends Activity implements View.OnClickListener {
    /** Called when the activity is first created. */
	
	Button btn;
	
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
//      setContentView(btn);
        setContentView(R.layout.now); // res:layout:main.xml
        
        btn = (Button) findViewById(R.id.button1);
      	btn.setOnClickListener(this);
//        updateTime();
    }
    
    public void onClick(View view){
    	checkUser();
    }

	private void checkUser() {
		EditText eText= (EditText) findViewById(R.id.editText1);
		EditText display= (EditText) findViewById(R.id.editText2);
		Editable eName=eText.getText();
		String name = eName.toString();
		if (name.equalsIgnoreCase("valeria"))
			display.setText("Ciao Valeria, visto che sei tu ti mando un bacio :-*");
		else
			display.setText("Ciao "+ name);
	}

	private void updateTime() {
//		btn.setText(new Date().toString());
		
	}
}

